<html class="js cssanimations"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link id="layuicss-laydate" rel="stylesheet" href="../速贷钱包2_files/laydate.css" media="all"><link id="layuicss-layer" rel="stylesheet" href="../速贷钱包2_files/layer.css" media="all"><link id="layuicss-skincodecss" rel="stylesheet" href="../速贷钱包2_files/code.css" media="all"></head><body>﻿



    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>速贷钱包</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" href="http://jsd.yidupay.cn/home/index/chose.html">
    <!--<link rel="stylesheet" href="__STATIC__/jishidai/css/amazeui.min.css">-->
<link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.7.2/css/amazeui.min.css">

    <link rel="stylesheet" href="__STATIC__/jishidai/css/inc.css">
    <link rel="stylesheet" href="__STATIC__/jishidai/css/layui.mobile.css">
    <style type="text/css">
        #container {
            width: 100%;
            display: inline-block;
            max-width: 840px;
            margin-top: 30px;
        }
        
        .formbox {
            width: 90%;
            float: left;
            margin: 10px 5%;
        }
        
        .formbox .title {
            width: 100%;
            letter-spacing: 2px;
            margin-bottom: 5px;
            line-height: 2em;
        }
        
        .formbox ul li {
            list-style-type: none;
            float: left;
            width: 48%;
            margin: 5px 1%;
            box-sizing: border-box;
            border: 1px solid #ccc;
            line-height: 2em;
            text-align: center;
            overflow: hidden;
        }
        
        .formbox ul li.active {
            background: #E41C26;
            color: #fff;
        }
        
        button {
            width: 90%;
            margin: 0 5%;
            line-height: 50px;
            text-align: center;
            color: #fff;
            background: #E41C26;
            border-radius: 5px;
        }
        
        .yuji {
            width: 90%;
            margin: 0 5%;
            line-height: 2em;
            font-size: 16px;
        }
        
        .yuji .price {
            font-size: 18px;
            color: red;
            font-weight: bold;
            padding: 0 5px;
        }
    </style>



    <div id="container">
            {foreach name="item" id="value"}
                <div class="formbox">
            <div class="title">{$value['item']}</div>
            <ul>
                {foreach name="value.son" id="v"}
                                <li data-price="{$v['price']}" data-id="{$v['id']}">{$v['item']}</li>
                {/foreach}
            </ul>
        </div>
            {/foreach}
                <div class="yuji">您的预计金额为:<span class="price">0</span>元</div>
        <button class="confirm" attr-id="">提交测评</button>
    </div>
    <script src="__STATIC__/jishidai/js/jquery-1.8.3.min.js"></script>
    <script src="__STATIC__/jishidai/js/amazeui.min.js"></script>
    <script src="__STATIC__/jishidai/js/layui.all.js"></script>
    <script src="js/jquery.base64.js"></script>
    <script>
        $(function() {
            $('#container .formbox ul').on('click', 'li', function() {
                var _this = $(this);
                if (_this.hasClass('active')) {
                    _this.parent().find('li').removeClass('active');
                } else {
                    _this.siblings().removeClass('active');
                    _this.addClass('active');
                }
                var newarr = new Array;
                var idstr = '';
                var totalprice = 0;
                $('#container .formbox').find('li.active').each(function() {
                    var id = $(this).attr('data-id');
                 	 var price = (Math.ceil(Math.random() * 3) * 1000) + 1000;
                  	var price = parseInt($(this).attr('data-price'));
                  price <0 ? price = 0 : '';
                    newarr.push(id);
                    totalprice += price;
                  console.log(price,totalprice);
                });
                idstr = newarr.join('-');
                $('#container .yuji').find('.price').text(totalprice);
                $('#container button.confirm').attr('data-id', idstr);
                $('#container button.confirm').attr('data-price', totalprice);

            })
            $('#container').on('click', 'button.confirm', function() {
                if ($('#container .formbox').find('li.active').length > 0) {
                    if ($('#container button.confirm').attr('data-price') == 0) {
                        alert('您可贷款额度为0');
                        return false;
                    }
                    if (confirm('是否开始测评') == true) {
                        var idstr = $('#container button.confirm').attr('data-id');
                        var url = "{:url('save_item')}?id=" + idstr ;
                        window.location.href = url;
                    } else {
                        return false;
                    }
                }

            })

        });
    </script>


</body></html>